Lines Matching defs:file
15 * otherwise, applies only to this software file. Patent licenses, if
41 * can handle all of the primitive types of file io.
105 #define MEMF_FILE 01000 /* regular file -- unlink on close */
119 * Structure for maintaining open file test descriptors. Used by
241 int k_opt = 0; /* lock file regions during writes */
245 int w_opt = 0; /* file write log file */
261 char *Infile; /* input file (defaults to stdin) */
287 * Global file descriptors
407 char *check_file(char *file, int offset, int length, char *pattern,
416 int alloc_fd(char *file, int oflags);
417 struct fd_cache *alloc_fdcache(char *file, int oflags);
534 umask(0); /* force new file modes to known values */
588 * to initialize the write history file. This call must be done in
589 * the parent, to ensure that the history file exists and/or has
591 * children are not allowed to truncate the file.
785 * Open a couple of descriptors for the write-log file. One descriptor
787 * file corruption detection. The program doio_check is capable of
797 "Could not open write log file (%s): wlog_open() failed\n",
804 * Open the input stream - either a file or stdin
812 "Could not open input file (%s): %s (%d)\n",
1303 " fd %d is file %s - open flags are %#o\n",
1306 sprintf(cp, " read done at file offset %d\n",
1315 " fd %d is file %s - open flags are %#o\n",
1319 " write done at file offset %d - pattern is %s\n",
1331 " fd %d is file %s - open flags are %#o\n",
1334 sprintf(cp, " reada done at file offset %d\n",
1350 " fd %d is file %s - open flags are %#o\n",
1354 " writea done at file offset %d - pattern is %s\n",
1407 char *addr, *file;
1422 file = req->r_data.read.r_file;
1427 /*printf("read: %s, %#o, %d %d\n", file, oflags, offset, nbytes); */
1430 * Grab an open file descriptor
1435 if ((fd = alloc_fd(file, oflags)) == -1)
1472 fdc = alloc_fdcache(file, oflags);
1503 /* move to the desired file position. */
1534 /* move to the desired file position. */
1604 char *addr, pattern, *file, *msg;
1624 file = req->r_data.write.r_file;
1627 /*printf("pwrite: %s, %#o, %d %d\n", file, oflags, offset, nbytes); */
1640 if ((fd = alloc_fd(file, oflags)) == -1)
1644 fd, file, oflags, offset, nbytes); */
1702 fdc = alloc_fdcache(file, oflags);
1744 if (lock_file_region(file, fd, F_WRLCK, offset, nbytes) < 0) {
1756 * re-creates the file extents as if the write completed, but does not
1770 wrec.w_pathlen = strlen(file);
1771 memcpy(wrec.w_path, file, wrec.w_pathlen);
1910 msg = check_file(file, offset, nbytes, Pattern, Pattern_Length,
1942 * Unlock file region if necessary
1946 if (lock_file_region(file, fd, F_UNLCK, offset, nbytes) < 0) {
1956 * Simple routine to lock/unlock a file using fcntl()
1970 "fcntl(%d, %d, %#o) failed for file %s, lock type %d, offset %d, length %d: %s (%d), open flags: %#o\n",
2157 * If the opcode is LO_WRITE, lock all regions of the file that
2160 * lock the entire region, regardless of the file stride.
2315 * Release file locks if necessary
2449 sprintf(cp, " fd %d is file %s - open flags are %#o %s\n",
2455 " write done at file offset %d - pattern is %c (%#o)\n",
2460 cp += sprintf(cp, " read done at file offset %d\n",
2491 " optimal file xfer size: small: %d large: %d\n",
2743 /* move to the desired file position. */
2888 * This version is oriented towards mmaping the file to memory
3063 char *addr, *file, *msg;
3082 file = req->r_data.io.r_file;
3110 * Get an open file descriptor
3115 if ((fd = alloc_fd(file, oflags)) == -1)
3144 fdc = alloc_fdcache(file, oflags);
3254 if (lock_file_region(file, fd, F_WRLCK,
3257 "file lock failed:\n%s\n",
3273 * re-creates the file extents as if the write completed, but does not
3288 wrec.w_pathlen = strlen(file);
3289 memcpy(wrec.w_path, file, wrec.w_pathlen);
3444 msg = check_file(file, offset, nbytes * nstrides * nents,
3472 * Unlock file region if necessary
3476 if (lock_file_region(file, fd, F_UNLCK,
3502 char *file, *msg;
3510 file = req->r_data.io.r_file;
3521 * Get an open file descriptor
3524 if ((fd = alloc_fd(file, oflags)) == -1)
3537 if (lock_file_region(file, fd, F_WRLCK,
3539 doio_fprintf(stderr, "file lock failed:\n");
3581 * Unlock file region if necessary
3585 if (lock_file_region(file, fd, F_UNLCK,
3604 char *file;
3611 file = req->r_data.io.r_file;
3615 * Get an open file descriptor
3618 if ((fd = alloc_fd(file, oflags)) == -1)
3673 "corrupt bytes starting at file offset %d\n",
3722 * Check the contents of a file beginning at offset, for length bytes. It
3724 * file. Use normal buffered reads to do the verification.
3730 * the FSA (unicos/mk). This implies the file will be opened
3732 * FSA will not allow the file to be opened for buffered io if it was
3736 char *check_file(char *file, int offset, int length, char *pattern,
3759 if ((fd = alloc_fd(file, flags)) == -1) {
3761 "Could not open file %s with flags %#o (%s) for data comparison: %s (%d)\n",
3762 file, flags, format_oflags(flags), SYSERR, errno);
3769 offset, file, SYSERR, errno);
3774 fdc = alloc_fdcache(file, flags);
3784 length, file, SYSERR, errno,
3790 length, file, SYSERR, errno);
3799 file, length, nb);
3810 file, offset, length, pattern, pattern_length,
4247 * Function to maintain a file descriptor cache, so that doio does not have
4249 * cache by file name, and open flags. Each entry also has a _rtc value
4250 * associated with it which is used in aging. If doio cannot open a file
4254 * If alloc_fd() is called with a file of NULL, it will close all descriptors
4258 int alloc_fd(char *file, int oflags)
4261 struct fd_cache *alloc_fdcache(char *file, int oflags);
4263 fdc = alloc_fdcache(file, oflags);
4270 struct fd_cache *alloc_fdcache(char *file, int oflags)
4281 * If file is NULL, it means to free up the fd cache.
4284 if (file == NULL && cache != NULL) {
4314 cp->c_oflags == oflags && strcmp(cp->c_file, file) == 0) {
4336 * No matching file/oflags pair was found in the cache. Attempt to
4340 if ((fd = open(file, oflags, 0666)) < 0) {
4343 "Could not open file %s with flags %#o (%s): %s (%d)\n",
4344 file, oflags, format_oflags(oflags),
4360 if ((fd = open(file, oflags, 0666)) < 0) {
4362 "Could not open file %s with flags %#o (%s): %s (%d)\n",
4363 file, oflags, format_oflags(oflags),
4370 /*printf("alloc_fd: new file %s flags %#o fd %d\n", file, oflags, fd);*/
4406 strcpy(free_slot->c_file, file);
5471 "\t-k Lock file regions during writes using fcntl()\n");
5475 "\t read() of the data if file io was done, or\n");
5500 "\t s - shared (shared file must exist\n"),
5509 "\t U - Unlink file when done\n");
5531 "\t-V validation_ftype The type of file descriptor to use for doing data\n");
5560 "\t-w write_log File to log file writes to. The doio_check\n");
5564 "\t write_log, and detect if a file is corrupt\n");