static int result_handler(void *ctx, int fields, char **row) { Bvfs *vfs = (Bvfs *)ctx; ATTR *attr = vfs->get_attr(); char empty[] = "A A A A A A A A A A A A A A"; memset(&attr->statp, 0, sizeof(struct stat)); decode_stat((row[BVFS_LStat] && row[BVFS_LStat][0])?row[BVFS_LStat]:empty, &attr->statp, sizeof(attr->statp), &attr->LinkFI); if (bvfs_is_dir(row) || bvfs_is_file(row)) { /* display clean stuffs */ if (bvfs_is_dir(row)) { pm_strcpy(attr->ofname, bvfs_basename_dir(row[BVFS_Name])); } else { /* if we see the requested file, note his filenameid */ if (bstrcmp(row[BVFS_Name], file)) { fnid = str_to_int64(row[BVFS_FilenameId]); } pm_strcpy(attr->ofname, row[BVFS_Name]); } print_ls_output(vfs->get_jcr(), attr); } else { Pmsg5(0, "JobId=%s FileId=%s\tMd5=%s\tVolName=%s\tVolInChanger=%s\n", row[BVFS_JobId], row[BVFS_FileId], row[BVFS_Md5], row[BVFS_VolName], row[BVFS_VolInchanger]); pm_strcpy(attr->ofname, file); print_ls_output(vfs->get_jcr(), attr); } return 0; }
static int bvfs_result_handler(void *ctx, int fields, char **row) { UAContext *ua = (UAContext *)ctx; char *fileid=row[BVFS_FileId]; char *lstat=row[BVFS_LStat]; char *jobid=row[BVFS_JobId]; char empty[] = "A A A A A A A A A A A A A A"; char zero[] = "0"; /* We need to deal with non existant path */ if (!fileid || !is_a_number(fileid)) { lstat = empty; jobid = zero; fileid = zero; } Dmsg1(100, "type=%s\n", row[0]); if (bvfs_is_dir(row)) { char *path = bvfs_basename_dir(row[BVFS_Name]); ua->send->object_start(row[BVFS_Name]); ua->send->object_key_value("Type", row[BVFS_Type]); ua->send->object_key_value("PathId", str_to_uint64(row[BVFS_PathId]), "%lld\t"); ua->send->object_key_value("FilenameId", FileId_t(0), "%lld\t"); ua->send->object_key_value("FileId", str_to_uint64(fileid), "%lld\t"); ua->send->object_key_value("JobId", str_to_uint64(jobid), "%lld\t"); ua->send->object_key_value("lstat", lstat, "%s\t"); ua->send->object_key_value("Name", path, "%s\n"); ua->send->object_key_value("Fullpath", row[BVFS_Name]); bvfs_stat(ua, lstat); ua->send->object_end(row[BVFS_Name]); } else if (bvfs_is_version(row)) { ua->send->object_start(row[BVFS_Name]); ua->send->object_key_value("Type", row[BVFS_Type]); ua->send->object_key_value("PathId", str_to_uint64(row[BVFS_PathId]), "%lld\t"); ua->send->object_key_value("FilenameId", str_to_uint64(row[BVFS_FilenameId]), "%lld\t"); ua->send->object_key_value("FileId", str_to_uint64(fileid), "%lld\t"); ua->send->object_key_value("JobId", str_to_uint64(jobid), "%lld\t"); ua->send->object_key_value("lstat", lstat, "%s\t"); ua->send->object_key_value("MD5", row[BVFS_Md5], "%s\t"); ua->send->object_key_value("VolumeName", row[BVFS_VolName], "%s\t"); ua->send->object_key_value("VolumeInChanger", str_to_uint64(row[BVFS_VolInchanger]), "%lld\n"); ua->send->object_end(row[BVFS_Name]); } else if (bvfs_is_file(row)) { ua->send->object_start(row[BVFS_Name]); ua->send->object_key_value("Type", row[BVFS_Type]); ua->send->object_key_value("PathId", str_to_uint64(row[BVFS_PathId]), "%lld\t"); ua->send->object_key_value("FilenameId", str_to_uint64(row[BVFS_FilenameId]), "%lld\t"); ua->send->object_key_value("FileId", str_to_uint64(fileid), "%lld\t"); ua->send->object_key_value("JobId", str_to_uint64(jobid), "%lld\t"); ua->send->object_key_value("lstat", lstat, "%s\t"); ua->send->object_key_value("Name", row[BVFS_Name], "%s\n"); bvfs_stat(ua, lstat); ua->send->object_end(row[BVFS_Name]); } return 0; }
static int bvfs_result_handler(void *ctx, int fields, char **row) { UAContext *ua = (UAContext *)ctx; struct stat statp; int32_t LinkFI; char *fileid=row[BVFS_FileId]; char *lstat=row[BVFS_LStat]; char *jobid=row[BVFS_JobId]; char empty[] = "A A A A A A A A A A A A A A"; char zero[] = "0"; /* We need to deal with non existant path */ if (!fileid || !is_a_number(fileid)) { lstat = empty; jobid = zero; fileid = zero; } memset(&statp, 0, sizeof(struct stat)); decode_stat(lstat, &statp, sizeof(statp), &LinkFI); Dmsg1(100, "type=%s\n", row[0]); if (bvfs_is_dir(row)) { char *path = bvfs_basename_dir(row[BVFS_Name]); ua->send_msg("%s\t0\t%s\t%s\t%s\t%s\n", row[BVFS_PathId], fileid, jobid, lstat, path); } else if (bvfs_is_version(row)) { ua->send_msg("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", row[BVFS_PathId], row[BVFS_FilenameId], fileid, jobid, lstat, row[BVFS_Md5], row[BVFS_VolName], row[BVFS_VolInchanger]); } else if (bvfs_is_file(row)) { ua->send_msg("%s\t%s\t%s\t%s\t%s\t%s\n", row[BVFS_PathId], row[BVFS_FilenameId], fileid, jobid, lstat, row[BVFS_Name]); } return 0; }