GithubHelp home page GithubHelp logo

tomzox / python-quota Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 1.0 203 KB

Python C extension module providing an interface to file system quotas on UNIX platforms

License: GNU General Public License v2.0

Python 20.74% C 79.26%
python3 python-extension capi system-administration

python-quota's Introduction

Python File-system Quota module

This repository contains the sources of the Python file-system quota module, which has its official home at PyPi.

The quota module allows accessing file system quotas on UNIX platforms. This works both for locally mounted file systems and network file systems (via RPC, i.e. Remote Procedure Call) for all the operating systems listed below. The interface is designed to be independent of UNIX flavours as well as file system types.

The C implementation of this module is derived from the Quota module for Perl (also at CPAN). I started developing the Perl module 1995, while working as a UNIX system administrator at university and kept maintaining it even after no longer working in this capacity. Since its beginnings, the module was continuously extended by porting to more UNIX platforms and file-systems. Numerous people have contributed to this process; for a complete list of names please see the CHANGES document in the repository. All this effort is now available also to Python users.

Module information

The following operating systems and file systems are supported transparently through a common API.

Supported operating systems:

  • Linux - kernel 2.0.30 - 4.15
  • FreeBSD 3 - 12.1, OpenBSD 2.2 - 6.6 & NetBSD 5 - 9
  • SunOS 4.1.3 (aka Solaris 1)
  • Solaris 2.4 - 2.10
  • HP-UX 9.0x & 10.10 & 10.20 & 11.00
  • IRIX 5.2 & 5.3 & 6.2 - 6.5
  • OSF/1 & Digital Unix 4
  • AIX 4.1, 4.2 and 5.3

Supported file systems:

  • Standard file systems of the platforms listed above
  • NFS (Network file system) on all of the above
  • XFS on Linux and IRIX 6
  • AFS (Andrew File System) on many of the above (see INSTALL)
  • VxFS (Veritas File System) on Solaris 2

Documentation

For further information please refer to the following files:

python-quota's People

Contributors

tomzox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

neerajkumarsj

python-quota's Issues

Q_XGETNEXTQUOTA: API for fast querying of quota for uid ranges

Linux kernel supports feature that allows for fast and efficient querying of all quota in the filesystem.

It's Q_XGETNEXTQUOTA ioctl.

https://patchwork.kernel.org/project/linux-fsdevel/patch/[email protected]/

This is feature request about adding support for it.

As simple API like:

(uid, bcount, bsoft, bhard, btime, icount, isoft, ihard, itime) = qObj.querynext(uid [,grpquota=1] [,prjquota=1])

or more complicated like

queryrange(uid, uid_last=False,...)

returning dictionary of uids with their quota tuples (or something like that)

For systems that don't support this feature it could be emulated by iterating from uid to (uid_t)-1 until found but... that can be a lot (if for example there is no single uid with quotas above our called uid). Or just FsQuota.error(ENOTSUP).

FTBFS with Python 3.9 on Debian unstable

Hi, while your module works nice on Debian stable, it fails to build on newer Debian systems:

python-fsquota$ python3 -V
Python 3.9.1

python-fsquota$ python3 setup.py build
Using hints/linux.h for myconfig.h
running build
running build_ext
building 'FsQuota' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -I/usr/include/python3.9 -c src/FsQuota.c -o build/temp.linux-x86_64-3.9/src/FsQuota.o
In file included from /usr/include/x86_64-linux-gnu/sys/param.h:23,
                 from ./myconfig.h:9,
                 from src/FsQuota.c:18:
src/FsQuota.c:34:46: error: invalid initializer
   34 | static PyTypeObject FsQuota_QuotaQueryType = NULL;
      |                                              ^~~~
src/FsQuota.c: In function ‘FsQuota_BuildQuotaResult’:
src/FsQuota.c:493:35: error: incompatible type for argument 1 of ‘PyStructSequence_New’
  493 |     RETVAL = PyStructSequence_New(FsQuota_QuotaQueryType);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
      |                                   |
      |                                   PyTypeObject {aka struct _typeobject}
In file included from /usr/include/python3.9/Python.h:128,
                 from src/FsQuota.c:16:
/usr/include/python3.9/structseq.h:32:59: note: expected ‘PyTypeObject *’ {aka ‘struct _typeobject *’} but argument is of type ‘PyTypeObject’ {aka ‘struct _typeobject’}
   32 | PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);
      |                                             ~~~~~~~~~~~~~~^~~~
src/FsQuota.c: In function ‘Quota_setqcarg’:
src/FsQuota.c:1956:63: warning: comparison of integer expressions of different signedness: ‘int’ and ‘__dev_t’ {aka ‘long unsigned int’} [-Wsign-compare]
 1956 |         if ((stat(mntent.path, &statbuf) == 0) && (target_dev == statbuf.st_dev))
      |                                                               ^~
src/FsQuota.c: In function ‘PyInit_FsQuota’:
src/FsQuota.c:2120:30: error: incompatible types when assigning to type ‘PyTypeObject’ {aka ‘struct _typeobject’} from type ‘PyTypeObject *’ {aka ‘struct _typeobject *’}
 2120 |     FsQuota_QuotaQueryType = PyStructSequence_NewType(&QuotaQuery_Desc);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~
src/FsQuota.c:2121:32: error: invalid operands to binary == (have ‘PyTypeObject’ {aka ‘struct _typeobject’} and ‘void *’)
 2121 |     if (FsQuota_QuotaQueryType == NULL)
      |                                ^~
src/FsQuota.c:2139:9: error: cannot convert to a pointer type
 2139 |         Py_DECREF(FsQuota_QuotaQueryType);
      |         ^~~~~~~~~
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.