1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 #include <linux/lustre_lib.h>
7 #include <linux/lustre_idl.h>
8 #include <linux/lustre_mds.h>
10 #include <attr/xattr.h>
12 #define XATTR_LUSTRE_MDS_OBJID "trusted.lov"
15 main(int argc, char *argv[])
17 struct lov_user_md *lmm1,*lmm2;
22 fprintf(stderr,"usage: copy_attr file1 file2 \n");
26 size = getxattr(argv[1], XATTR_LUSTRE_MDS_OBJID, NULL, 0);
28 perror("getting attr size");
33 if (lmm1 == NULL || lmm2 == NULL) {
34 fprintf(stderr,"Failure to get memory \n");
38 if (getxattr(argv[1], XATTR_LUSTRE_MDS_OBJID, lmm1, size) < 0) {
39 perror("getting xattr :");
43 if (stat(argv[2], &statbuf)) {
48 memcpy(lmm2, lmm1, size);
49 lmm2->lmm_object_id = statbuf.st_ino;
50 if (setxattr(argv[2], XATTR_LUSTRE_MDS_OBJID, lmm2, size, 0) < 0) {