/*
- * Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <xfs/libxfs.h>
#include "output.h"
#include "type.h"
#include "init.h"
+#include "fprint.h"
+#include "faddr.h"
+#include "field.h"
#include "inode.h"
#include "malloc.h"
static const cmdinfo_t attr_set_cmd =
{ "attr_set", "aset", attr_set_f, 1, -1, 0,
- "[-r|-s|-p|-u] [-R|-C] [-v n] name",
- "set the named attribute on the current inode", attrset_help };
+ N_("[-r|-s|-p|-u] [-n] [-R|-C] [-v n] name"),
+ N_("set the named attribute on the current inode"), attrset_help };
static const cmdinfo_t attr_remove_cmd =
{ "attr_remove", "aremove", attr_remove_f, 1, -1, 0,
- "[-r|-s|-p|-u] name",
- "remove the named attribute from the current inode", attrset_help };
+ N_("[-r|-s|-p|-u] [-n] name"),
+ N_("remove the named attribute from the current inode"), attrset_help };
static void
attrset_help(void)
{
- dbprintf(
+ dbprintf(_(
"\n"
" The 'attr_set' and 'attr_remove' commands provide interfaces for debugging\n"
" the extended attribute allocation and removal code.\n"
" -u -- 'user' (default)\n"
" -s -- 'secure'\n"
"\n"
-" For attr_set, these options further define the type of set:\n"
+" For attr_set, these options further define the type of set operation:\n"
" -C -- 'create' - create attribute, fail if it already exists\n"
" -R -- 'replace' - replace attribute, fail if it does not exist\n"
-"\n");
+" The backward compatibility mode 'noattr2' can be emulated (-n) also.\n"
+"\n"));
}
void
int c, namelen, valuelen = 0, flags = 0;
if (cur_typ == NULL) {
- dbprintf("no current type\n");
+ dbprintf(_("no current type\n"));
return 0;
}
if (cur_typ->typnm != TYP_INODE) {
- dbprintf("current type is not inode\n");
+ dbprintf(_("current type is not inode\n"));
return 0;
}
- while ((c = getopt(argc, argv, "rusCRv:")) != EOF) {
+ while ((c = getopt(argc, argv, "rusCRnv:")) != EOF) {
switch (c) {
/* namespaces */
case 'r':
flags |= LIBXFS_ATTR_REPLACE;
break;
+ case 'n':
+ mp->m_flags |= LIBXFS_MOUNT_COMPAT_ATTR;
+ break;
+
/* value length */
case 'v':
valuelen = (int)strtol(optarg, &sp, 0);
if (*sp != '\0' || valuelen < 0 || valuelen > 64*1024) {
- dbprintf("bad attr_set valuelen %s\n", optarg);
+ dbprintf(_("bad attr_set valuelen %s\n"), optarg);
return 0;
}
break;
default:
- dbprintf("bad option for attr_set command\n");
+ dbprintf(_("bad option for attr_set command\n"));
return 0;
}
}
if (optind != argc - 1) {
- dbprintf("too few options for attr_set (no name given)\n");
+ dbprintf(_("too few options for attr_set (no name given)\n"));
return 0;
}
if (valuelen) {
value = (char *)memalign(getpagesize(), valuelen);
if (!value) {
- dbprintf("cannot allocate buffer (%d)\n", valuelen);
+ dbprintf(_("cannot allocate buffer (%d)\n"), valuelen);
goto out;
}
memset(value, 0xfeedface, valuelen);
goto out;
}
- if (libxfs_attr_set_int(ip, name, namelen, value, valuelen, flags)) {
+ if (libxfs_attr_set(ip, name, value, valuelen, flags)) {
dbprintf(_("failed to set attr %s on inode %llu\n"),
name, (unsigned long long)iocur_top->ino);
goto out;
set_cur_inode(iocur_top->ino);
out:
+ mp->m_flags &= ~LIBXFS_MOUNT_COMPAT_ATTR;
if (ip)
libxfs_iput(ip, 0);
if (value)
int c, namelen, flags = 0;
if (cur_typ == NULL) {
- dbprintf("no current type\n");
+ dbprintf(_("no current type\n"));
return 0;
}
if (cur_typ->typnm != TYP_INODE) {
- dbprintf("current type is not inode\n");
+ dbprintf(_("current type is not inode\n"));
return 0;
}
- while ((c = getopt(argc, argv, "rus")) != EOF) {
+ while ((c = getopt(argc, argv, "rusn")) != EOF) {
switch (c) {
/* namespaces */
case 'r':
flags &= ~LIBXFS_ATTR_ROOT;
break;
+ case 'n':
+ mp->m_flags |= LIBXFS_MOUNT_COMPAT_ATTR;
+ break;
+
default:
- dbprintf("bad option for attr_remove command\n");
+ dbprintf(_("bad option for attr_remove command\n"));
return 0;
}
}
if (optind != argc - 1) {
- dbprintf("too few options for attr_remove (no name given)\n");
+ dbprintf(_("too few options for attr_remove (no name given)\n"));
return 0;
}
goto out;
}
- if (libxfs_attr_remove_int(ip, name, namelen, flags)) {
+ if (libxfs_attr_remove(ip, name, flags)) {
dbprintf(_("failed to remove attr %s from inode %llu\n"),
name, (unsigned long long)iocur_top->ino);
goto out;
set_cur_inode(iocur_top->ino);
out:
+ mp->m_flags &= ~LIBXFS_MOUNT_COMPAT_ATTR;
if (ip)
libxfs_iput(ip, 0);
return 0;