Lines Matching refs:name

909 	ntfs_list_for_each_safe(item, tmp, &file->name) {
912 ntfs_log_debug("freeing filename '%s'", f->name ? f->name :
914 if (f->name)
915 free(f->name);
928 ntfs_log_debug("Freeing data stream '%s'.\n", d->name ?
929 d->name : UNNAMED);
930 if (d->name)
931 free(d->name);
943 * @name: a filename of the file
946 * Check that @rec is the parent of the file represented by @name.
947 * If @rec is a directory, but it is created after @name, then we
948 * can't determine whether @rec is really @name's parent.
950 * Return: @rec's filename, either same name space as @name or lowest space.
953 static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec)
960 if (!name || !rec)
979 /* if name is older than this dir -> can't determine */
980 if (ntfs2timespec(filename_attr->creation_time).tv_sec > name->date_c) {
984 if (filename_attr->file_name_type != name->name_space) {
991 if (filename_attr->file_name_type == name->name_space) {
1007 * get_parent_name - Find the name of a file's parent.
1008 * @name: the filename whose parent's name to find
1010 static void get_parent_name(struct filename* name, ntfs_volume* vol)
1017 if (!name || !vol)
1031 inode_num = MREF_LE(name->parent_mref);
1037 } else if ((filename_attr = verify_parent(name, rec))) {
1040 &name->parent_name, 0) < 0) {
1044 name->parent_name = NULL;
1061 * Rescue the last deleted name of a file
1063 * Under some conditions, when a name is deleted and the MFT
1064 * record is shifted to reclaim the space, the name is still
1071 * Returns NULL when the name cannot be recovered.
1077 struct filename *name;
1082 name = (struct filename*)NULL;
1087 * If the data attribute replaced the name attribute,
1088 * the name itself is at offset 0x58 from the data attr.
1098 /* check whether the name is fully allocated */
1103 /* create a (partial) name record */
1104 name = (struct filename*)
1105 ntfs_calloc(sizeof(*name));
1106 if (name) {
1107 name->uname = (ntfschar*)
1109 name->uname_len = length;
1110 name->name_space = type;
1111 if (ntfs_ucstombs(name->uname, length,
1112 &name->name, 0) < 0) {
1113 free(name);
1114 name = (struct filename*)NULL;
1117 if (name && name->name)
1118 ntfs_log_verbose("Recovered file name %s\n",
1119 name->name);
1123 return (name);
1133 * Windows creates a short DOS name for each long name, e.g. LONGFI~1.XYZ,
1142 * and its locale friendly name is put in pref_name.
1152 struct filename *name;
1168 name = calloc(1, sizeof(*name));
1169 if (!name) {
1176 name->uname = attr->file_name;
1177 name->uname_len = attr->file_name_length;
1178 name->name_space = attr->file_name_type;
1179 name->size_alloc = sle64_to_cpu(attr->allocated_size);
1180 name->size_data = sle64_to_cpu(attr->data_size);
1181 name->flags = attr->file_attributes;
1183 name->date_c = ntfs2timespec(attr->creation_time).tv_sec;
1184 name->date_a = ntfs2timespec(attr->last_data_change_time).tv_sec;
1185 name->date_m = ntfs2timespec(attr->last_mft_change_time).tv_sec;
1186 name->date_r = ntfs2timespec(attr->last_access_time).tv_sec;
1188 if (ntfs_ucstombs(name->uname, name->uname_len, &name->name,
1194 name->parent_name = NULL;
1197 name->parent_mref = attr->parent_directory;
1198 get_parent_name(name, vol);
1201 if (name->name_space < space) {
1202 file->pref_name = name->name;
1203 file->pref_pname = name->parent_name;
1204 space = name->name_space;
1207 file->max_size = max(file->max_size, name->size_alloc);
1208 file->max_size = max(file->max_size, name->size_data);
1210 ntfs_list_add_tail(&name->list, &file->name);
1215 name = rescue_name(file->mft,ctx);
1216 if (name) {
1217 /* a name was recovered, get missing attributes */
1218 file->pref_name = name->name;
1224 name->flags = attr->file_attributes;
1226 name->date_c = ntfs2timespec(attr->creation_time).tv_sec;
1227 name->date_a = ntfs2timespec(attr->last_data_change_time).tv_sec;
1228 name->date_m = ntfs2timespec(attr->last_mft_change_time).tv_sec;
1229 name->date_r = ntfs2timespec(attr->last_access_time).tv_sec;
1235 name->size_alloc = sle64_to_cpu(attr->allocated_size);
1236 name->size_data = sle64_to_cpu(attr->data_size);
1238 ntfs_list_add_tail(&name->list, &file->name);
1295 &data->name, 0) < 0) {
1296 ntfs_log_error("ERROR: Cannot translate name "
1356 NTFS_INIT_LIST_HEAD(&file->name);
1580 ntfs_list_for_each(item, &file->name) {
1584 ntfs_log_quiet("Filename: (%d) %s\n", f->name_space, f->name);
1631 ntfs_log_quiet("Name: %s\n", (d->name) ? d->name : UNNAMED);
1691 const char *name = NULL;
1710 if (!d->name) {
1728 name = file->pref_name;
1730 name = NONE;
1734 percent, buffer, size, name);
1739 * name_match - Does a file have a name matching a regex
1757 ntfs_list_for_each(item, &file->name) {
1761 if (!f->name)
1764 result = regexec(re, f->name, 0, NULL, 0);
1820 * @name: Filename to give the file (optional)
1831 * All the components are optional. If the name is missing, "unknown" will be
1833 * directory. If the stream name is present it will be appended to the
1836 * N.B. If the buffer isn't large enough the name will be truncated.
1838 * Return: n Length of the allocated name
1840 static int create_pathname(const char *dir, const char *name,
1848 if (!name)
1849 name = UNKNOWN;
1854 snprintf(buffer, bufsize, "%s\\%s:%s", dir, name,
1857 snprintf(buffer, bufsize, "%s\\%s", dir, name);
1860 snprintf(buffer, bufsize, "%s/%s:%s", dir, name,
1863 snprintf(buffer, bufsize, "%s/%s", dir, name);
1867 snprintf(buffer, bufsize, "%s:%s", name, stream);
1869 snprintf(buffer, bufsize, "%s", name);
1892 * @pathname: Path, name and stream of the file to open
1920 * @pathname: Path and name of the file to alter
1953 * Each data stream will be recovered and saved to a file. The file's name will
1957 * The output file's name and location can be altered by using the command line
1979 char *name;
2036 name = opts.output;
2039 name = file->pref_name;
2043 name = defname;
2046 create_pathname(opts.dest, name, d->name, pathname, sizeof(pathname));
2190 if (d->name)
2192 file->pref_name, d->name, pathname);
2212 * The list can be filtered by name, size and date, using command line options.
2355 const char *name;
2380 name = opts.output;
2381 if (!name) {
2382 name = MFTFILE;
2384 name);
2387 create_pathname(opts.dest, name, NULL, pathname, sizeof(pathname));
2390 ntfs_log_perror("Couldn't create output file '%s'", name);