2009-01-29 10:52:08 +01:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
aaip-os-dummy.c
|
|
|
|
|
|
|
|
|
|
Idle placeholder for:
|
|
|
|
|
Arbitrary Attribute Interchange Protocol , system adapter for getting and
|
2009-02-19 09:36:22 +01:00
|
|
|
|
setting of ACLs and xattr.
|
2009-01-29 10:52:08 +01:00
|
|
|
|
|
|
|
|
|
See aaip-os-linux.c for a real implementation of this interface.
|
|
|
|
|
|
|
|
|
|
To be included by aaip_0_2.c
|
2009-02-19 09:36:22 +01:00
|
|
|
|
|
2025-04-16 09:19:10 +02:00
|
|
|
|
Copyright (c) 2009 - 2025 Thomas Schmitt
|
2018-10-06 20:40:08 +02:00
|
|
|
|
|
|
|
|
|
This file is part of the libisofs project; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
|
or later as published by the Free Software Foundation.
|
|
|
|
|
See COPYING file for details.
|
2009-02-19 09:36:22 +01:00
|
|
|
|
|
2009-01-29 10:52:08 +01:00
|
|
|
|
*/
|
|
|
|
|
|
2010-05-16 10:20:12 +02:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include "../config.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-01-29 10:52:08 +01:00
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
|
|
|
2011-08-18 15:07:31 +02:00
|
|
|
|
/* ------------------------------ Inquiry --------------------------------- */
|
|
|
|
|
|
|
|
|
|
/* See also API iso_local_attr_support().
|
|
|
|
|
@param flag
|
|
|
|
|
Bitfield for control purposes
|
|
|
|
|
bit0= inquire availability of ACL
|
|
|
|
|
bit1= inquire availability of xattr
|
|
|
|
|
bit2 - bit7= Reserved for future types.
|
|
|
|
|
It is permissibile to set them to 1 already now.
|
|
|
|
|
bit8 and higher: reserved, submit 0
|
|
|
|
|
@return
|
2015-08-01 16:58:40 +02:00
|
|
|
|
Bitfield corresponding to flag.
|
2011-08-18 15:07:31 +02:00
|
|
|
|
bit0= ACL adapter is enabled
|
|
|
|
|
bit1= xattr adapter is enabled
|
2024-11-03 19:17:32 +01:00
|
|
|
|
bit2= Linux-like file attribute flags (chattr) adapter is enabled
|
|
|
|
|
bit3= inquire availability of XFS-style project id
|
|
|
|
|
bit4 - bit7= Reserved for future types.
|
2011-08-18 15:07:31 +02:00
|
|
|
|
bit8 and higher: reserved, do not interpret these
|
|
|
|
|
*/
|
|
|
|
|
int aaip_local_attr_support(int flag)
|
|
|
|
|
{
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-01-29 10:52:08 +01:00
|
|
|
|
/* ------------------------------ Getters --------------------------------- */
|
|
|
|
|
|
|
|
|
|
/* Obtain the ACL of the given file in long text form.
|
|
|
|
|
@return 0 ACL support not enabled at compile time
|
|
|
|
|
*/
|
|
|
|
|
int aaip_get_acl_text(char *path, char **text, int flag)
|
|
|
|
|
{
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Obtain the Extended Attributes and/or the ACLs of the given file in a form
|
|
|
|
|
that is ready for aaip_encode().
|
|
|
|
|
@return 1 ok
|
|
|
|
|
*/
|
|
|
|
|
int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
|
|
|
|
|
size_t **value_lengths, char ***values, int flag)
|
|
|
|
|
{
|
|
|
|
|
*num_attrs= 0;
|
|
|
|
|
*names= NULL;
|
|
|
|
|
*value_lengths= NULL;
|
|
|
|
|
*values= NULL;
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-07-16 15:05:11 +02:00
|
|
|
|
/* Obtain the file attribute flags of the given file as bit array in uint64_t.
|
|
|
|
|
The bit numbers are compatible to the FS_*_FL definitions in Linux.
|
|
|
|
|
*/
|
|
|
|
|
int aaip_get_lfa_flags(char *path, uint64_t *lfa_flags, int *max_bit,
|
|
|
|
|
int *os_errno, int flag)
|
|
|
|
|
{
|
|
|
|
|
*lfa_flags= 0;
|
|
|
|
|
*max_bit= -1;
|
|
|
|
|
*os_errno= 0;
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-11-03 19:17:32 +01:00
|
|
|
|
/* Obtain the project id for XFS-style quota management.
|
|
|
|
|
*/
|
|
|
|
|
int aaip_get_projid(char *path, uint32_t *projid, int *os_errno, int flag)
|
|
|
|
|
{
|
|
|
|
|
*projid= 0;
|
|
|
|
|
*os_errno= 0;
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-01-29 10:52:08 +01:00
|
|
|
|
/* ------------------------------ Setters --------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Set the ACL of the given file to a given list in long text form.
|
|
|
|
|
@return 0 ACL support not enabled at compile time
|
|
|
|
|
*/
|
|
|
|
|
int aaip_set_acl_text(char *path, char *text, int flag)
|
|
|
|
|
{
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Bring the given attributes and/or ACLs into effect with the given file.
|
|
|
|
|
@param flag Bitfield for control purposes
|
|
|
|
|
bit0= decode and set ACLs
|
|
|
|
|
bit1= first clear all existing attributes of the file
|
|
|
|
|
bit2= do not set attributes other than ACLs
|
|
|
|
|
@return 1 success (there was nothing to do)
|
|
|
|
|
-6 support of xattr not enabled at compile time
|
|
|
|
|
-7 support of ACL not enabled at compile time
|
|
|
|
|
*/
|
|
|
|
|
int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
|
2017-10-23 10:36:10 +02:00
|
|
|
|
size_t *value_lengths, char **values, int *errnos,
|
|
|
|
|
int flag)
|
2009-01-29 10:52:08 +01:00
|
|
|
|
{
|
|
|
|
|
size_t i;
|
|
|
|
|
|
2017-10-23 10:36:10 +02:00
|
|
|
|
for(i= 0; i < num_attrs; i++)
|
|
|
|
|
errnos[i]= 0;
|
|
|
|
|
|
2009-01-29 10:52:08 +01:00
|
|
|
|
for(i= 0; i < num_attrs; i++) {
|
|
|
|
|
if(names[i] == NULL || values[i] == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
if(names[i][0] == 0) { /* ACLs */
|
|
|
|
|
if(flag & 1)
|
|
|
|
|
return(-7);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
/* Extended Attribute */
|
2011-08-08 08:25:18 +02:00
|
|
|
|
if(flag & 4)
|
|
|
|
|
continue;
|
|
|
|
|
if(!(flag & 8))
|
|
|
|
|
if(strncmp(names[i], "user.", 5))
|
|
|
|
|
continue;
|
|
|
|
|
return(-6);
|
2009-01-29 10:52:08 +01:00
|
|
|
|
}
|
|
|
|
|
if(flag & 2)
|
|
|
|
|
return(-6);
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-07-16 15:05:11 +02:00
|
|
|
|
int aaip_set_lfa_flags(char *path, uint64_t lfa_flags, int max_bit,
|
|
|
|
|
int *os_errno, int flag)
|
|
|
|
|
{
|
|
|
|
|
*os_errno= 0;
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-11-03 19:17:32 +01:00
|
|
|
|
/* Set the project id for XFS-style quota management.
|
|
|
|
|
*/
|
|
|
|
|
int aaip_set_projid(char *path, uint32_t projid, int *os_errno, int flag)
|
|
|
|
|
{
|
|
|
|
|
*os_errno= 0;
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-04-16 09:19:10 +02:00
|
|
|
|
|
|
|
|
|
/* -------- API for creating device files in the local filesystem --------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* API */
|
|
|
|
|
/* @param flag bit0= do not issue error messages
|
|
|
|
|
*/
|
|
|
|
|
int iso_local_create_dev(char *disk_path, mode_t st_mode, dev_t dev,
|
|
|
|
|
int *os_errno, int flag)
|
|
|
|
|
{
|
|
|
|
|
/* From man mknod:
|
|
|
|
|
POSIX.1-2001 says: "The only portable use of mknod() is to create a
|
|
|
|
|
FIFO-special file. If mode is not S_IFIFO or dev is not 0, the behav‐
|
|
|
|
|
ior of mknod() is unspecified."
|
|
|
|
|
*/
|
|
|
|
|
*os_errno= 0;
|
|
|
|
|
if(!(flag & 1))
|
|
|
|
|
iso_msg_submit(-1, ISO_DEV_NO_CREATION, 0,
|
|
|
|
|
"File \"%s\" cannot be created because device file creation is not enabled",
|
|
|
|
|
disk_path);
|
|
|
|
|
return ISO_DEV_NO_CREATION;
|
|
|
|
|
}
|
|
|
|
|
|