Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(7)

Delta Between Two Patch Sets: Modules/_stat.c

Issue 21719: Returning Windows file attribute information via os.stat()
Left Patch Set: Created 5 years, 10 months ago
Right Patch Set: Created 5 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Modules/posixmodule.c ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* stat.h interface 1 /* stat.h interface
2 * 2 *
3 * The module defines all S_IF*, S_I*, UF_*, SF_* and ST_* constants to 3 * The module defines all S_IF*, S_I*, UF_*, SF_* and ST_* constants to
4 * sensible default values as well as defines S_IS*() macros in order to keep 4 * sensible default values as well as defines S_IS*() macros in order to keep
5 * backward compatibility with the old stat.py module. 5 * backward compatibility with the old stat.py module.
6 * 6 *
7 * New constants and macros such as S_IFDOOR / S_ISDOOR() are always defined 7 * New constants and macros such as S_IFDOOR / S_ISDOOR() are always defined
8 * as int 0. 8 * as int 0.
9 * 9 *
10 * NOTE: POSIX only defines the values of the S_I* permission bits. 10 * NOTE: POSIX only defines the values of the S_I* permission bits.
(...skipping 11 matching lines...) Expand all
22 #include <sys/types.h> 22 #include <sys/types.h>
23 #endif /* HAVE_SYS_TYPES_H */ 23 #endif /* HAVE_SYS_TYPES_H */
24 24
25 #ifdef HAVE_SYS_STAT_H 25 #ifdef HAVE_SYS_STAT_H
26 #include <sys/stat.h> 26 #include <sys/stat.h>
27 #endif /* HAVE_SYS_STAT_H */ 27 #endif /* HAVE_SYS_STAT_H */
28 28
29 #ifdef MS_WINDOWS 29 #ifdef MS_WINDOWS
30 #include <windows.h> 30 #include <windows.h>
31 typedef unsigned short mode_t; 31 typedef unsigned short mode_t;
32
33 /* FILE_ATTRIBUTE_INTEGRITY_STREAM and FILE_ATTRIBUTE_NO_SCRUB_DATA
34 are not present in VC2010, so define them manually */
35 #ifndef FILE_ATTRIBUTE_INTEGRITY_STREAM
36 # define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x8000
37 #endif
38 #ifndef FILE_ATTRIBUTE_NO_SCRUB_DATA
39 # define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x20000
40 #endif
41
32 #endif 42 #endif
33 43
34 /* From Python's stat.py */ 44 /* From Python's stat.py */
35 #ifndef S_IMODE 45 #ifndef S_IMODE
36 # define S_IMODE 07777 46 # define S_IMODE 07777
37 #endif 47 #endif
38 48
39 /* S_IFXXX constants (file types) 49 /* S_IFXXX constants (file types)
40 * 50 *
41 * Only the names are defined by POSIX but not their value. All common file 51 * Only the names are defined by POSIX but not their value. All common file
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 if (PyModule_AddIntConstant(m, "ST_INO", 1)) return NULL; 562 if (PyModule_AddIntConstant(m, "ST_INO", 1)) return NULL;
553 if (PyModule_AddIntConstant(m, "ST_DEV", 2)) return NULL; 563 if (PyModule_AddIntConstant(m, "ST_DEV", 2)) return NULL;
554 if (PyModule_AddIntConstant(m, "ST_NLINK", 3)) return NULL; 564 if (PyModule_AddIntConstant(m, "ST_NLINK", 3)) return NULL;
555 if (PyModule_AddIntConstant(m, "ST_UID", 4)) return NULL; 565 if (PyModule_AddIntConstant(m, "ST_UID", 4)) return NULL;
556 if (PyModule_AddIntConstant(m, "ST_GID", 5)) return NULL; 566 if (PyModule_AddIntConstant(m, "ST_GID", 5)) return NULL;
557 if (PyModule_AddIntConstant(m, "ST_SIZE", 6)) return NULL; 567 if (PyModule_AddIntConstant(m, "ST_SIZE", 6)) return NULL;
558 if (PyModule_AddIntConstant(m, "ST_ATIME", 7)) return NULL; 568 if (PyModule_AddIntConstant(m, "ST_ATIME", 7)) return NULL;
559 if (PyModule_AddIntConstant(m, "ST_MTIME", 8)) return NULL; 569 if (PyModule_AddIntConstant(m, "ST_MTIME", 8)) return NULL;
560 if (PyModule_AddIntConstant(m, "ST_CTIME", 9)) return NULL; 570 if (PyModule_AddIntConstant(m, "ST_CTIME", 9)) return NULL;
561 571
562 #ifdef MS_WINDOWS 572 #ifdef MS_WINDOWS
Zach Ware 2014/06/13 15:49:28 Even though these constants are really only useful
haypo 2014/06/13 16:00:20 The purpose of the _stat module is to only provide
Zach Ware 2014/06/13 22:56:16 This is just the opposite of the situation for the
563 // For some reason FILE_ATTRIBUTE_INTEGRITY_STREAM and
Zach Ware 2014/06/13 15:49:28 PEP 7 bans C++ style comments.
564 // FILE_ATTRIBUTE_NO_SCRUB_DATA are not present in VC2010,
Zach Ware 2014/06/13 15:49:28 As the API doc says, those two are related to ReFS
haypo 2014/06/13 16:00:20 If the constant is only available on new Visual St
565 // so define them manually
566 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_ARCHIVE)) return NULL; 573 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_ARCHIVE)) return NULL;
567 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_COMPRESSED)) return NULL; 574 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_COMPRESSED)) return NULL;
568 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_DEVICE)) return NULL; 575 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_DEVICE)) return NULL;
569 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_DIRECTORY)) return NULL; 576 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_DIRECTORY)) return NULL;
570 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_ENCRYPTED)) return NULL; 577 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_ENCRYPTED)) return NULL;
571 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_HIDDEN)) return NULL; 578 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_HIDDEN)) return NULL;
572 if (PyModule_AddIntConstant(m, "FILE_ATTRIBUTE_INTEGRITY_STREAM", 0x8000)) r eturn NULL; 579 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_INTEGRITY_STREAM)) return NULL;
573 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_NORMAL)) return NULL; 580 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_NORMAL)) return NULL;
574 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)) return NULL ; 581 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)) return NULL ;
575 if (PyModule_AddIntConstant(m, "FILE_ATTRIBUTE_NO_SCRUB_DATA", 0x20000)) ret urn NULL; 582 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_NO_SCRUB_DATA)) return NULL;
576 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_OFFLINE)) return NULL; 583 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_OFFLINE)) return NULL;
577 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_READONLY)) return NULL; 584 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_READONLY)) return NULL;
578 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_REPARSE_POINT)) return NULL; 585 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_REPARSE_POINT)) return NULL;
579 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_SPARSE_FILE)) return NULL; 586 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_SPARSE_FILE)) return NULL;
580 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_SYSTEM)) return NULL; 587 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_SYSTEM)) return NULL;
581 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_TEMPORARY)) return NULL; 588 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_TEMPORARY)) return NULL;
582 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_VIRTUAL)) return NULL; 589 if (PyModule_AddIntMacro(m, FILE_ATTRIBUTE_VIRTUAL)) return NULL;
583 #endif 590 #endif
584 591
585 return m; 592 return m;
586 } 593 }
587 594
588 #ifdef __cplusplus 595 #ifdef __cplusplus
589 } 596 }
590 #endif 597 #endif
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+