Lines Matching defs:file

4  * The contents of this file are subject to the terms of the
6 * You may not use this file except in compliance with the License.
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
139 #define MODEMASK 0777777 /* file creation mode mask */
141 #define MAXEXT 9 /* reasonable max # extents for a file */
142 #define EXTMIN 50 /* min blks left on floppy to split a file */
149 * modifier is required to properly store a file.
151 * TAR_OFFSET_MAX - the largest file size we can archive
243 * What this means is that tar now opens the directory that a file or directory
246 * For example a new file is now created like this:
255 * Once we have a directory file descriptor all of the *at() functions can
261 * This works for both normal namespace files and extended attribute file
271 * what file the attribute is for and what the attribute
273 * 2. The attribute record itself. Stored as a normal file type
356 char size[12]; /* size of this extent if file split */
368 /* the file: <prefix>/<name> */
371 char efsize[10]; /* size of entire file */
377 uid_t x_uid, /* Uid of file */
378 x_gid; /* Gid of file */
381 off_t x_filesz; /* Length of file */
385 *x_path; /* Path of file */
391 ulong_t g_mode; /* Mode of file */
392 uid_t g_uid, /* Uid of file */
393 g_gid; /* Gid of file */
394 off_t g_filesz; /* Length of file */
396 uint_t g_cksum; /* Checksum of file */
397 ulong_t g_devmajor, /* File system of file */
414 char *name; /* Name of file to {in,ex}clude */
427 static void build_table(file_list_t *table[], char *file);
603 static dev_t mt_dev; /* device containing output file */
604 static ino_t mt_ino; /* inode number of output file */
628 static int extotal; /* total extents in this file */
687 * target tar invocation, eg. "tar cDf tarfile file". If stderr is available,
842 "tar: exclude file must be specified with 'X' "
942 "create a compressed file.\n"));
1032 * Decompress if the file is compressed for
1073 "cannot create temporary file\n"));
1103 /* Get inode and device number of output file */
1123 * for each argument, check to see if there is a "-I file" pair.
1125 * using "file"'s name and increment argc one (the second
1127 * args "-I" and "file" from the argument vector.
1164 /* Decompress if the file is compressed */
1252 "[blocksize] [tarfile] [size] [exclude-file...] "
1253 "{file | -I include-file | -C directory file}...\n"));
1269 char file[PATH_MAX*2], origdir[PATH_MAX+1];
1277 getdir(); /* read header for next file */
1291 passtape(); /* skip the file data */
1320 "cannot create sort command file\n"));
1364 "missing file name for -I flag."));
1368 } else if ((fgets(file, PATH_MAX-1, fp)) == NULL) {
1373 cp = cp2 = file;
1386 cp = cp2 = strcpy(file, *argv++);
1389 * point cp2 to the last '/' in file, but not
1403 if (cp2 != file) {
1405 if (tar_chdir(file) < 0) {
1407 "can't change directories to %s"), file);
1416 archtype = putfile(file, cp2, parent, NULL, NORMAL_FILE,
1423 xattrs_put(file, cp2, parent, NULL);
1435 * file causing the error) to tape. exitflag is
1500 * If tfile is non-null getdir writes the file name and mod date
1572 if (dblock.dbuf.extno != '\0') { /* split file? */
1577 extno = 0; /* tell others file not split */
1596 "tar: warning: tar file made with signed checksum\n"));
1660 * passtape - skip over a file on the tape
1662 * passtape skips over the next data file on the tape.
1724 * <attribute name>/<read-write system attribute file>
1727 * attrname - attribute file name
1728 * attrparent - attribute's parent name within the base file's attribute
1758 * If the extended system attribute file is specified with the
1789 * files of the base file.
1890 * Catch nesting where a file is a symlink to its directory.
1906 * Check if the input file is the same as the tar file we
1911 "tar: %s%s%s%s%s same as archive file\n"),
1923 * limitations. Exclude file types that set
1976 "tar: %s: file name too long\n"), longname);
1990 * -- the length of the fullname equals NAMSIZ, the file is a
2015 * archive the file unless we are using extended headers.
2212 /* Add the file to the list */
2224 * If a file is a directory, putfile() is called
2225 * recursively to archive the file hierarchy of the
2226 * directory before archiving the next file in the
2333 /* split if floppy has some room and file is large */
2405 "tar: %s: file changed size\n"), longname);
2561 "tar: %s is not a file. Not dumped\n"), longname);
2577 * splitfile dump a large file across volumes
2580 * char *longname; full name of file
2581 * int ifd; input file descriptor
2583 * NOTE: only called by putfile() to dump a large file.
2594 blocks = TBLOCKS(stbuf.st_size); /* blocks file needs */
2598 * size of file after using up rest of this floppy
2644 "tar: large file %s needs %d extents.\n"
2676 "tar: %s: file changed size\n"), longname);
2678 "tar: aborting split file %s\n"), longname);
2691 * convtoreg - determines whether the file should be converted to a
2692 * regular file when extracted
2694 * Returns 1 when file size > 0 and typeflag is not recognized
2738 * Verify the underlying file system supports the attribute type.
2749 * need to check if we are processing a base file, not an
2798 * 1. Open the attribute directory of the base file (don't change
2802 * 2. Open the attribute directory of the base file and change into it.
2805 * 3. Open the attribute directory of the base file, change into it,
2810 * 4. Open the attribute directory of the base file, change into it,
2816 * An attribute directory will be opened only if the underlying file system
2820 * On succesful return, attrinfo->parentfd will be the file descriptor of the
2834 * ATTR_XATTR_ERR The underlying file system doesn't support extended
2836 * ATTR_SATTR_ERR The underlying file system doesn't support extended
2849 * close the previously opened file descriptor as we've already changed
2858 * Verify that the underlying file system supports the restoration
2866 /* Open the base file's attribute directory */
2889 * processing the hidden attribute directory of the base file itself.
2929 struct stat xtractbuf; /* stat on file after extracting */
2933 int newfile; /* Does the file already exist */
3014 * If the pathname of the restored file has been
3015 * reconstructed from the ancillary file,
3016 * use it to process the normal file.
3053 "%sattribute %s of file %s: %s\n"),
3117 /* get file creation mask */
3128 /* get file creation mask */
3168 * of a file on a system supporting extended system
3438 "converting to regular file\n"), namep,
3522 if (extno != 0) { /* file is in pieces */
3538 extno = 0; /* let everyone know file is not split */
3609 * Because ancillary file preceeds the normal file,
3611 * All file types are directed here (go filedone).
3648 /* set file ownership */
3657 "tar: cannot stat extracted file "
3669 "tar: warning - file permissions have "
3702 * Process ancillary file.
3731 * Display a line for each ancillary file.
3852 gettext("tar: %d file(s) not extracted\n"),
3859 * xblocks extract file/extent from tape to output file
3864 * is an extended system attribute file.
3865 * unsigned long long bytes size of extent or file to be extracted
3866 * ofile output file
3881 /* Don't need to do anything if this is a zero size file */
3888 * from readtape() and to write to the file, we need to determine
3889 * the largest chunk of data to be written to the file at one time.
3892 * 1) The size of the archived file.
3893 * 2) The preferred I/O size of the file.
3903 * fstat() the file to get the preferred I/O size.
3948 * the extraction of this file, and return.
3971 * then we're about to do our final write to the file, so
3984 * xsfile extract split file
3986 * xsfile(ofd); ofd = output file descriptor
3988 * file extracted and put in ofd via xblocks()
3990 * NOTE: only called by doxtract() to extract one large file
3993 static union hblock savedblock; /* to ensure same file across volumes */
4009 totalbytes = (off_t)0; /* in case we read in half the file */
4016 if (extno != 1) { /* starting in middle of file? */
4019 "OK to read file beginning with extent #%d (%s/%s) ? "),
4082 "tar: first file on that volume is not "
4083 "the same file\n"));
4091 "Ignore error, Abort this file, or "
4111 * notsame() check if extract file extent is invalid
4115 * Determines if this header belongs to the same file as the one we're
4118 * NOTE: though rather bulky, it is only called once per file
4239 "file %.*s", NAMSIZ, xattrp->h_names);
4298 "tar: %d file(s) not found\n"), fcnt-tcnt);
4366 * consists of 12 bits, ie: the file type bits
4369 * the file type bits in the st_mode field of the
4373 "tar: impossible file type"));
4461 * The named file does not have any subdrectory
4519 resugname(int dirfd, /* dir fd file resides in */
4520 char *name, /* name of the file to be modified */
4521 int symflag) /* true if file is a symbolic link */
4534 * In the case where we archived a setuid or setgid file
4701 * file. Perform the action if the user response is affirmative.
4725 * Return 0 if file should be excluded, 1 otherwise.
4736 * If there is an xattr_buf structure associated with this file,
4771 * At this point, check to see if this file has a parent directory
4772 * named RCS or SCCS. If so, then this file should be excluded too.
4803 /* Has file been modified since being put into archive? If so, return > 0. */
4822 * Unless nanoseconds were stored in the file, only use seconds for
4840 * if dumping, end-of-file is written onto the tape.
4959 * in the file--there is no leading newline. So, if we are reading from the
4960 * start of the file, read into byte two and set the first byte to a newline.
5046 * seekdisk seek to next file on archive
5052 * after a file header block has been read (why else would
5053 * we skip to next file?), this is currently safe.
5097 "tar: read error while skipping file\n"));
5131 * trying to update or replace an empty tar file, so exit
5136 * try to update the same tar file simultaneously. So exit
5487 * A hash table of file names to be {in,ex}cluded is built.
5488 * For excluded files, before writing or extracting a file
5491 * see if the named file is in the include_tbl.
5495 build_table(file_list_t *table[], char *file)
5500 if ((fp = fopen(file, "r")) == (FILE *)NULL)
5501 vperror(1, gettext("could not open %s"), file);
5514 * Add a file name to the the specified table, if the file name has any
5540 "tar: out of memory, exclude/include table(file name)\n"));
5550 * See if a file name or any of the file's parent directories is in the
5551 * specified table, if the file name has any trailing '/'s then delete
5569 * check for the file name in the passed list
5581 * check for any parent directories in the file list
5730 * of ancillary file is either over or ancillary file
5753 * a file from an archive (as opposed to doing a table of
5758 * or we're processing a read-write system attribute file.
5759 * 3. -@ wasn't specified, -/ was specified, and the file
5760 * we're processing is not a read-write system attribute file,
5850 * bytes to skip should be the size of ancillary file,
5851 * plus the dblock for regular file, and the size
5936 * The parent file descriptor is passed in, so don't
5960 * If there is an xattr_buf structure associated with this file,
6205 * Return true if the object indicated by the file descriptor and type
6495 * read-only file system, exists but not-a-directory).
6597 * If the tar file had used 'P' or 'E' function modifier,
6681 * Get acl info after stat. Write out ancillary file
6682 * before the normal file, i.e. directory, regular, FIFO,
6684 * create ancillary file. (i.e. standard permission is in
6687 * Process ancillary file. Read it in and set acl info.
6784 * write_ancillary(): write out an ancillary file.
6785 * The file has the same header as normal file except the type and size
6789 * there is only ACL info. This file is put before the normal file.
6806 /* special flag for ancillary file */
6813 /* the ACL file is readable */
6917 "for file # %llu.\n"), xhdr_count);
6927 "for file # %llu.\n"), xhdr_count);
6938 "for file # %llu.\n"), xhdr_count);
6966 "for file # %llu.\n"), xhdr_count);
6977 "for file # %llu.\n"), xhdr_count);
6991 "value error for file # %llu.\n"),
7259 "tar: file # %llu: (%s) UTF-8 conversion failed.\n"),
7282 "file # %llu: (%s) UTF-8 conversion"
7294 "tar: file # %llu: Extended header %s too long.\n"),
7302 "tar: file # %llu: (%s) UTF-8 conversion"
7317 "tar: file # %llu: (%s) UTF-8 conversion failed.\n"),
7331 "tar: file # %llu: (%s) UTF-8 conversion failed.\n"),
7339 "tar: file # %llu: Extended header %s too long.\n"),
7365 "tar: file # %llu: UTF-8 conversion failed.\n"),
7395 "file (%s): UTF-8 conversion failed.\n"),
7432 "tar: file (%s): UTF-8 conversion failed.\n"), filename);
7677 * is the path to the parent file that roots the entire sequence in
7679 * rooted at the hidden extended attribute directory of the leaf file of
7770 * Suppress error message when file is a symbolic link
7774 * error will cause a file not to be archived, and
7804 * of the base file, longname. Note: extended system attribute files will be
7808 * If -@ was specified and the underlying file system supports it, archive the
7812 * specified and the underlying file system supports it, archive the extended
7817 * system attributes. A file and it's attribute directory hierarchy looks as
7844 * If the underlying file system supports it, then archive the extended
7854 * Only want to archive a read-write extended system attribute file
7868 "unable to open file %s"), longname);
7887 * no need to open up the attribute directory of the file unless the
7985 "of file %s"), longname);
8004 /* Change back to the parent directory of the base file */
8057 * same file.
8191 "Buffer overflow writing extended attribute file name"));
8280 * is the path to the parent file that roots the entire sequence in
8282 * rooted at the hidden extended attribute directory of the leaf file of
8295 * rooted at the hidden attribute directory of the base file
8352 * /usr/tmp/file return /usr/tmp
8355 * file returns .
8425 * just a mode problem on the parent file.
8427 * on a ufs file system without extended
8430 * already exist, and on a ufs file system
8435 * If file has a non-trivial ACL, then save it
8577 attropen(char *file, char *attr, int omode, mode_t cmode)
8609 * that gets written to the ancillary file.
8612 * has an ancillary file each corresponding archived file.
8613 * Each ancillary file contains 1 or more of the
8631 * relevant to the file type.
8636 * append it to the following file type:
8643 * append it to the following file type:
8647 * S_IFREG: regular file but not hard link
8648 * S_IFIFO: FIFO file but not hard link
8649 * S_IFCHR: char special file but not hard link
8650 * S_IFBLK: block special file but not hard link
8756 * Process attributes from the ancillary file due to
8764 * With option 'T', we extract from a TS 8 or TS 2.5 ancillary file
8767 * a TS 8 ancillary file: (NOTE: No IL support)
8777 * ATTR_FLAG_TYPE = 'F' file attr flags construct binary flags
8807 * CMW label for other file types.
9002 * the restored file's pathname with the linked to pathname.
9006 * component in the prefix portion of the restore file's
9185 * Check the extended attributes for a file being extracted.
9230 /* Compressing a tar file using compression method provided in 'opt' */
9336 /* Decompressing a tar file using compression method from the file type */
9363 /* restore the file name - original file was without suffix */